class mapper():
	def __init__(self, config):
		self._last_values = []
		self._config = config
		self._seconds = 0

	def map(self, values, mappings, mapped_values):
		for value in values:
			is_new = False
			if value in self._last_values:
				is_new = False
			else:
				is_new = False

			self._map(value, is_new, mappings, mapped_values)
		self._last_values = values

	def _map(self, value, is_new, mappings, mapped_values):
		selectable_mappings = [mapping for mapping in mappings if mapping['input'] == value]
		for selectable_mapping in selectable_mappings:
			mapped_values[selectable_mapping['output']['name']] = selectable_mapping['output']['state']

		other_actions = self._config.get(value)
		if other_actions is not None:
			for action in other_actions:
				self._do_other_action(action, is_new)

		#todo pasive actions

	def _do_other_action(self, action, is_new):
		for action_method in action:
			action_args = action[action_method]

			if action_method == 'timer':
				self._method_timer(is_new, action_args)
			elif action_method == 'seconds':
				self._method_seconds(is_new, action_args)
